cmake_minimum_required(VERSION 3.1)
cmake_policy(SET CMP0048 NEW)
project(libnsq VERSION 0.1.0.0)

# options
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -O2 -DDEBUG -fPIC ")

include_directories("${CMAKE_CURRENT_BINARY_DIR}"
	"${PROJECT_BINARY_DIR}"
	)

set(NSQ
command.c
http.c
message.c
nsqd_connection.c
nsqlookupd.c
reader.c
)

set(TEST
test.c
)

# target
add_executable(nsqcli ${TEST} ${NSQ})
target_link_libraries(nsqcli ev m evbuffsock curl json-c)
add_library(nsq SHARED ${NSQ}) 

# install
install(TARGETS nsqcli DESTINATION bin)
install(TARGETS nsq LIBRARY DESTINATION lib) 
install(FILES  nsq.h DESTINATION include) 
install(FILES  utlist.h DESTINATION include) 
